package com.fis.mca;

import java.io.BufferedWriter;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.fis.vaadin.util.BrowserInfo;
import com.vaadin.Application;
import com.vaadin.terminal.gwt.server.ApplicationServlet;
import com.vaadin.terminal.gwt.server.WebApplicationContext;
import com.vaadin.ui.Window;

public class MainServlet extends ApplicationServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void writeAjaxPageHtmlVaadinScripts(Window window,
			String themeName, Application application, BufferedWriter page,
			String appUrl, String themeUri, String appId,
			HttpServletRequest request) throws ServletException, IOException {
		page.write("<script language='javascript' src='./VAADIN/jquery/jquery-1.4.4.min.js'></script>\n");
		page.write("<script language='javascript' src='./VAADIN/js/highcharts.js'></script>\n");
		page.write("<script language='javascript' src='./VAADIN/js/modules/exporting.js'></script>\n");
		// page.write("<script language='javascript' src='http://api.easyjquery.com/easyjquery.js'></script>\n");
		super.writeAjaxPageHtmlVaadinScripts(window, themeName, application,
				page, appUrl, themeUri, appId, request);

		/*
		 * <script language="javascript" src=
		 * "/HelloWeb/VAADIN/widgetsets/com.fis.mca.widgetset.Hlo_icbs_web_appWidgetset/com.fis.mca.widgetset.Hlo_icbs_web_appWidgetset.nocache.js?1344747493424"
		 * ></script>
		 */
	}

	@Override
	protected WebApplicationContext getApplicationContext(HttpSession session) {

		if (BrowserInfo.getWebBrowser() == null)
			BrowserInfo.setWebBrowser(WebApplicationContext
					.getApplicationContext(session).getBrowser());

		return super.getApplicationContext(session);
	}
}
